home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist6.3 / gl_dev.idb / usr / share / src / OpenGL / demos / stonehenge / Stone.h.z / Stone.h
Encoding:
C/C++ Source or Header  |  1996-12-06  |  1.4 KB  |  62 lines

  1. #ifndef STONE_H
  2. #define STONE_H
  3.  
  4. #include "Color.h"
  5. #include "Point.h"
  6.  
  7. class Stone {
  8.  public:
  9.   Stone();
  10.   ~Stone();
  11.   Stone operator=(Stone a);
  12.  
  13.   void set_dimensions(GLfloat x, GLfloat y, GLfloat z);
  14.   void set_dimensions(Point p);
  15.   Point get_dimensions() {return dimensions;};
  16.  
  17.   /* p = 0 --> sharp corners, p == 1 --> completely rounded corners */
  18.   void erode(float p);
  19.   float get_erosion() {return erosion;};
  20.  
  21.   void translate(GLfloat x, GLfloat y, GLfloat z);
  22.   void translate(Point p);
  23.  
  24.   /* Angle in degrees */
  25.   void rotate_self_aboutz(GLfloat angle);
  26.  
  27.   void draw();
  28.  
  29.   void draw_shadow(Point dlight);
  30.   void draw_shadow(Point dlight, GLfloat blur, Color color, Color diffuse);
  31.  
  32.  private:
  33.   Point translation;
  34.   GLfloat rotation;
  35.   /* dimensions contains the length, width, and height of the stone */
  36.   Point dimensions;
  37.  
  38.   GLfloat erosion;
  39.  
  40.   Point points[24];
  41.   int points_valid;
  42.   void compute_points();
  43.  
  44.   int transforms_valid;
  45.   inline Point trans_rot_point(Point p, float c, float s);
  46.   inline Point transform_point(Point p, float c, float s);
  47.   void transform_points();
  48.   
  49.   void draw_faces(int flat = 0);
  50.   void draw_faces(Point *p, int flat = 0);
  51.  
  52.   void draw_edges(int flat = 0);
  53.   void draw_edges(Point *p, int flat = 0);
  54.   void draw_edge(Point n1, Point n2, Point *p, int a, int b, int c, int d,
  55.          int flat = 0);
  56.  
  57.   void draw_corners(int flat = 0) {draw_corners(points, flat);};
  58.   void draw_corners(Point *p, int flat = 0);
  59. };
  60.  
  61. #endif
  62.